const { Model, DataTypes } = require('sequelize')
const { createFields } = require('../helper')
module.exports = (sequelize) => {
  class RoleMenu extends Model {}
  RoleMenu.init(
    {
      menuId: {
        type: DataTypes.STRING(20),
        references: {
          model: 'sys_menu',
          key: 'id',
        },
        allowNull: false,
      },
      roleId: {
        type: DataTypes.STRING(20),
        references: {
          model: 'sys_role',
          key: 'id',
        },
        allowNull: false,
      },
    },
    {
      sequelize,
      tableName: 'sys_role_menu',
      timestamps: true,
      modelName: 'RoleMenu',
    }
  )

  return RoleMenu
}
